package edu.gmu.dglidde2.ece612.scheduler;

/**
 * The interface that must be implemented by a scheduler.
 * 
 * @author Doug Glidden
 */
public interface Scheduler {

	/**
	 * Adds a processor to the list of processors supported by the
	 * <code>Scheduler</code>.
	 * 
	 * Calling this method after the {@link #generateSchedule()} method will not
	 * modify the previously generated schedule.
	 * 
	 * @param processorName
	 *            the processor name. The processor name must not be null or an
	 *            empty string.
	 */
	public void addProcessor(String processorName);

	/**
	 * Adds a task to the list of tasks to be scheduled by the
	 * <code>Scheduler</code>.
	 * 
	 * Calling this method after the {@link #generateSchedule()} method will not
	 * modify the previously generated schedule.
	 * 
	 * @param task
	 *            the task. The task must not be null and must be valid (as
	 *            indicated by the {@link Task#isValid()} method).
	 */
	public void addTask(Task task);

	/**
	 * Attempts to generate and return a schedule for the provided tasks on the
	 * provided processors.
	 * 
	 * @return the generated {@link Schedule}.
	 * @throws MissingDataException
	 *             when data required for schedule generation has not been
	 *             provided, such as when:
	 *             <ul>
	 *             <li>No processors have been added via the
	 *             {@link #addProcessor(String)} method prior to calling this
	 *             method.</li>
	 *             <li>No tasks have been added via the {@link #addTask(Task)}
	 *             method prior to calling this method.</li>
	 *             <li>A task that was added via the {@link #addTask(Task)}
	 *             specifies one or more processors that were not added via the
	 *             {@link #addProcessor(String)} method prior to calling this
	 *             method.</li>
	 *             </ul>
	 * @throws NoFeasibleScheduleException
	 *             when the scheduler is unable to find a feasible schedule for
	 *             the provided tasks on the provided processors.
	 */
	public Schedule generateSchedule() throws MissingDataException,
			NoFeasibleScheduleException;

}
